﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace ConsoleApp2
{
    class QuickSortClass
    {
        static void QuickSort(int[] crr, int low, int high)
        {
            if (low < high)
            {
                int mid = Getmid(crr, low, high);
                QuickSort(crr, low, mid - 1);
                QuickSort(crr, mid + 1, high);
            }
        }
        static int Getmid(int[] crr, int low, int high)
        {
            int  x = crr[low];
            while (low < high)
            {
                while (low < high && crr[high] >= x)
                {
                    high--;
                }
                crr[low] = crr[high];
                while (low < high && crr[low] <= x)
                {
                    low++;
                }
                crr[high] = crr[low];
            }
            crr[low] = x;
            return low;
        }
    }
}
